package com.jabo.wechatmomentsdemo.utils;

import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;

import androidx.annotation.StringRes;

import com.jabo.wechatmomentsdemo.R;
import com.jabo.wechatmomentsdemo.app.MomentsApplication;

/**
 * @anthor JZheng3
 * @Time: 2020/9/4
 */
public class StringUtil {

    public static String getStringById(@StringRes int id) {
        return MomentsApplication.getInstance().getString(id);
    }

    public static Spannable spannableString(int start, int end, String str) {
        SpannableString ss = new SpannableString(str);
        ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(MomentsApplication.getInstance().getResources().getColor((R.color.color_62667f)));
        ss.setSpan(foregroundColorSpan, start, end, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
        return ss;
    }
}
